]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
loginDialog: Update banner asynchronously
authorFlorian Müllner <fmuellner@gnome.org>
Fri, 22 Nov 2024 18:36:42 +0000 (19:36 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Tue, 4 Feb 2025 12:10:10 +0000 (13:10 +0100)
We will soon allow reading the banner text from a file. Prepare
for that by making the method asynchronous.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3558>

js/gdm/loginDialog.js

index c3c397c0d1791f7bfab33c3b73945de2d08a8139..125cf299fa583289fa8526f5bb23b5db54a6f068 100644 (file)
@@ -505,9 +505,9 @@ export const LoginDialog = GObject.registerClass({
         this._settings = new Gio.Settings({schema_id: GdmUtil.LOGIN_SCREEN_SCHEMA});
 
         this._settings.connect(`changed::${GdmUtil.BANNER_MESSAGE_KEY}`,
-            this._updateBanner.bind(this));
+            () => this._updateBanner().catch(logError));
         this._settings.connect(`changed::${GdmUtil.BANNER_MESSAGE_TEXT_KEY}`,
-            this._updateBanner.bind(this));
+            () => this._updateBanner().catch(logError));
         this._settings.connect(`changed::${GdmUtil.DISABLE_USER_LIST_KEY}`,
             this._updateDisableUserList.bind(this));
         this._settings.connect(`changed::${GdmUtil.LOGO_KEY}`,
@@ -576,7 +576,7 @@ export const LoginDialog = GObject.registerClass({
         this._bannerLabel.clutter_text.line_wrap = true;
         this._bannerLabel.clutter_text.ellipsize = Pango.EllipsizeMode.NONE;
         bannerBox.add_child(this._bannerLabel);
-        this._updateBanner();
+        this._updateBanner().catch(logError);
 
         this._sessionMenuButton = new SessionMenuButton();
         this._sessionMenuButton.connect('session-activated',
@@ -873,16 +873,19 @@ export const LoginDialog = GObject.registerClass({
         this._authPrompt.cancelButton.visible = cancelVisible;
     }
 
-    _getBannerText() {
+    async _getBannerText() {
         const enabled = this._settings.get_boolean(GdmUtil.BANNER_MESSAGE_KEY);
         if (!enabled)
             return null;
 
+        // placeholder
+        await false;
+
         return this._settings.get_string(GdmUtil.BANNER_MESSAGE_TEXT_KEY);
     }
 
-    _updateBanner() {
-        const text = this._getBannerText();
+    async _updateBanner() {
+        const text = await this._getBannerText();
 
         if (text) {
             this._bannerLabel.set_text(text);